{{extend './common/layout.html'}} {{block 'main'}}
<div class="login-body">
    <div class="login-container">
        <h4 class="title">博客管理员登录</h4>
        <div class="login">
            <form action="/admin/login" method="post" id="loginForm">
                <div class="form-group">
                    <label>邮件</label>
                    <input name="email" type="email" class="form-control" placeholder="请输入邮件地址">
                </div>
                <div class="form-group">
                    <label>密码</label>
                    <input name="password" type="password" class="form-control" placeholder="请输入密码">
                </div>
                <button type="submit" class="btn btn-primary">登录</button>
            </form>
        </div>
        <div class="tips"></div>
    </div>
</div>
{{/block}} {{block 'script'}}
<script src="/admin/js/common.js"></script>
<script type="text/javascript">
    $(function() {
        $('#loginForm').on('submit', function() {
            let result = serialize2Json($(this)); //将表单数据转为json格式的数据
            if (result.email.trim().length == 0) {
                alert('请输入email！')
                return false
            }
            if (result.password.trim().length == 0) {
                alert('请输入password！')
                return false
            }
            // return false//默认阻止提交数据跳转
        })
    })
</script>
{{/block}}